﻿using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Flowgraph;
using Flowgraph.Editor.Maths;

namespace Flowgraph.Editor.Graphics
{
    public class Sprite
    {
        protected Texture2D m_Texture;

        protected BasicEffect m_BasicEffect;

        protected VertexPositionTexture[] m_Geometry;

        protected virtual void GenerateGeometry()
        {
            m_Geometry = new VertexPositionTexture[4]; //Triangle Strips

            m_Geometry[0] = new VertexPositionTexture(new Vector3(-1f, -1f, 0f), new Vector2(0f, 0f));
            m_Geometry[1] = new VertexPositionTexture(new Vector3(-1f, 1f, 0f), new Vector2(0f, 1f));
            m_Geometry[2] = new VertexPositionTexture(new Vector3(1f, 1f, 0f), new Vector2(1f, 1f));
            m_Geometry[3] = new VertexPositionTexture(new Vector3(1f, -1f, 0f), new Vector2(1f, 0f));

            //m_BasicEffect
        }

        public virtual void Draw()
        {
            Core.GraphicsManager.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, m_Geometry, 0, 2);
        }
    }
}
